import 'package:flutter/material.dart';
import 'package:flutter_bloc/flutter_bloc.dart';
import 'package:t_upgrade_plugin/bloc/app_version_bloc.dart';
import 'package:t_upgrade_plugin/routes/upgrade_routes.dart';
import 'package:common/common.dart';

class UpgradeRegistrar extends ModuleRegistrar {
  static BuildType _buildType;

  UpgradeRegistrar({BuildType buildType}) : super() {
    _buildType = buildType;
  }

  static BuildType get buildType => _buildType;

  @override
  LocalizationsDelegate get localizationsDelegate => null;

  @override
  ModuleRouteManager get routerManager => UpgradeRoutes();

  @override
  Map<String, Bloc> get globalBlocs => {AppVersionBloc.blocName: AppVersionBloc(AppVersionState())};

  @override
  Function(GlobalEvent) get eventHandler => (event) async {
        if (event is GlobalLoginEvent) {
          return;
        }
        if (event is GlobalLogoutEvent) {
          return;
        }
      };

  @override
  void setBuildType(BuildType buildType) {
    if (_buildType == null) {
      _buildType = buildType;
    }
  }
}
